using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.Shared;

namespace QLHXNK.Forms
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private ParameterFields myParameterFields = new ParameterFields();

        private ParameterField startMonthField = new ParameterField();
        private ParameterField endMonthField = new ParameterField();
        private ParameterField startYearhField = new ParameterField();
        private ParameterField endYearField = new ParameterField();

        private ParameterDiscreteValue startYearValue = new ParameterDiscreteValue();
        private ParameterDiscreteValue endYearValue = new ParameterDiscreteValue();

        private ParameterDiscreteValue startMonthValue = new ParameterDiscreteValue();
        private ParameterDiscreteValue endMonthValue = new ParameterDiscreteValue();


        public Form1(int fromMonth,int toMonth, int fromYear, int toYear)
        {
            InitializeComponent();
            startMonthField.ParameterFieldName = "FromMonth";
            endMonthField.ParameterFieldName = "ToMonth";

            startYearhField.ParameterFieldName = "FromYear";
            endYearField.ParameterFieldName = "ToYear";

            startMonthValue.Value = fromMonth;
            startMonthField.CurrentValues.Add(startMonthValue);
            myParameterFields.Add(startMonthField);

            endMonthValue.Value = toMonth;
            endMonthField.CurrentValues.Add(endMonthValue);
            myParameterFields.Add(endMonthField);



            startYearValue.Value = fromYear;
            startYearhField.CurrentValues.Add(startYearValue);
            myParameterFields.Add(startYearhField);

            endYearValue.Value = toYear;
            endYearField.CurrentValues.Add(endYearValue);
            myParameterFields.Add(endYearField);

            //crViewerBanHang.ParameterFieldInfo = myParameterFields;
            //crViewerBanHang.Refresh();
            TableLogOnInfos logons = new TableLogOnInfos();
            TableLogOnInfo logon = new TableLogOnInfo();
            ConnectionInfo connectionInfo = new ConnectionInfo();
            //connectionInfo.DatabaseName = "phoenix";
            connectionInfo.Password = "cC26AbB";
            logon.ConnectionInfo = connectionInfo;
            logons.Add(logon);
            crystalReportViewer1.ParameterFieldInfo = myParameterFields;
            crystalReportViewer1.LogOnInfo = logons;
            crystalReportViewer1.DisplayGroupTree = false;
            crystalReportViewer1.Refresh();
        }
    }
}